FROM node:18-alpine as builder
WORKDIR /app
COPY . .

RUN npm ci
RUN npm run migration:run
RUN npm run build

FROM node:18-alpine
WORKDIR /app
COPY --from=builder /app ./

EXPOSE 3333
CMD ["npm", "run", "start:prod"]
